package app.model;

import app.controller.IMDBController;
import app.util.BigFile;
import app.util.DHTConnector;
import app.util.workers.LoadDataWorker;

public class IMDBModel {

	private IMDBController controller = null;
	
	public IMDBModel(IMDBController controller){
		this.controller = controller;
	}

	public void fileSelected(String fileName) {
		//start a new thread to load the data from the file in the background
		LoadDataWorker loadDataThread = new LoadDataWorker(this, fileName);
		loadDataThread.execute();
	}
	
	public void loadDataFinished() {
		controller.dataImportFinished();
	}
	public void getRequest(String key) {
		String[] values = DHTConnector.get(key);
		controller.answerGetRequest(key, values);
	}

}
